package nyist.media.page;

import lombok.Getter;
import lombok.Setter;

/**
 * @author dcf
 */
@Getter
@Setter
public class ThreadLocalMap {

    public static final String CODE = "code";

    public static final String MSG = "msg";

    public static final String ERR_MSG = "error";

    private ThreadLocal<ApiResultMap<String, Object>> threadLocal = new ThreadLocal<>();

    public static ApiResultMap<String, Object> get() {
        ThreadLocalMap tlm = new ThreadLocalMap();
        ApiResultMap<String, Object> map = tlm.getThreadLocal().get();
        if (map == null) {
            map = new ApiResultMap<>();
            tlm.getThreadLocal().set(map);
        }
        return map;
    }

    private ThreadLocalMap() {
    }
}
